package com.naza.rpc.circuitBreaker;

/**
 * 熔断器状态虚类
 * Abstract state of the CircuitBreaker state machine.
 *
 * @author yl
 */
abstract class CircuitBreakerState {

    //熔断器
    protected CircuitBreakerImpl circuitBreaker;

    CircuitBreakerState(CircuitBreakerImpl circuitBreaker) {
        this.circuitBreaker = circuitBreaker;
    }

    //调用是否被允许
    abstract boolean isCallPermitted();

    //记录调用失败
    abstract void recordFailure();

    //记录调用成功
    abstract void recordSuccess();

    //获取当前状态
    abstract CircuitBreaker.State getState();
}
